//
//  HYLStatusBottonView.swift
//  iOSwechat
//
//  Created by apple on 16/3/3.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

class HYLStatusBottonView: UIView {

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        prepareUI()
    }

    func prepareUI(){
        
        // 添加子控件
        addSubview(forwardBtn)
        addSubview(commentBtn)
        addSubview(likeBtn)
        addSubview(separatorViewFirst)
        addSubview(separatorViewSecond)
        
        // 添加约束
        // 按钮pingpu
        let multipliedBy = 1 / 3.0
        // 转发
        forwardBtn.snp_makeConstraints { (make) -> Void in
            make.leading.top.bottom.equalTo(self)
            make.width.equalTo(self).multipliedBy(multipliedBy)
        }
        
        // 评论
        commentBtn.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(forwardBtn.snp_trailing)
            make.top.bottom.equalTo(self)
            make.width.equalTo(self).multipliedBy(multipliedBy)
        }
        
        // 点赞
        likeBtn.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(commentBtn.snp_trailing)
            make.top.bottom.equalTo(self)
            make.width.equalTo(self).multipliedBy(multipliedBy)
        }
        
        // 分割线1
        separatorViewFirst.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(forwardBtn.snp_trailing)
            make.centerY.equalTo(forwardBtn)
        }
        
        // 分割线2
        separatorViewSecond.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(commentBtn.snp_trailing)
            make.centerY.equalTo(commentBtn)
        }
        

    }
    
    // MARK: - 懒加载
    // 转发数
    private lazy var forwardBtn: UIButton = UIButton(title: "转发", fontSize: 11, imageName: "timeline_icon_retweet", bkgimageView: "timeline_card_bottom_background")
    
    // 评论数
    private lazy var commentBtn: UIButton = UIButton(title: "评论", fontSize: 11, imageName: "timeline_icon_comment", bkgimageView: "timeline_card_bottom_background")
    
    // 点赞数
    private lazy var likeBtn: UIButton = UIButton(title: "赞", fontSize: 11, imageName: "timeline_icon_unlike", bkgimageView: "timeline_card_bottom_background")
    
    // 分割线1
    private lazy var separatorViewFirst:UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    
    // 分割线2
    private lazy var separatorViewSecond:UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    
}


